<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<%@ include file="/web/header.jsp" %>
<title>主界面</title>
</head>
<body class="layui-layout-body">
<div class="layui-layout layui-layout-admin">
  <div class="layui-header">
    <div class="layui-logo">员工绩效管理系统</div>
    <!-- 头部区域（可配合layui已有的水平导航） -->
    <ul class="layui-nav layui-layout-left">
      <!-- <li class="layui-nav-item"><a href="">控制台</a></li>
      <li class="layui-nav-item"><a href="">商品管理</a></li>
      <li class="layui-nav-item"><a href="">用户</a></li>
      <li class="layui-nav-item">
        <a href="javascript:;">其它系统</a>
        <dl class="layui-nav-child">
          <dd><a href="">邮件管理</a></dd>
          <dd><a href="">消息管理</a></dd>
          <dd><a href="">授权管理</a></dd>
        </dl>
      </li> -->
    </ul>
    <ul class="layui-nav layui-layout-right">
      <li class="layui-nav-item">
        <a href="javascript:;">
          <!-- <img src="/company/web/base/img/y2.jpg" class="layui-nav-img"> -->
          <img src="/image/${ user.head }" class="layui-nav-img">
          	欢迎[${user.name}]
        </a>
        <dl class="layui-nav-child">
          <!-- <dd><a href="">修改资料</a></dd>
          <dd><a href="javascript:;" >修改密码</a></dd> -->
          <dd><a href="javascript:updamge()">修改头像</a></dd>
        </dl>
      </li>
      <li class="layui-nav-item"><a href="javascript:toLogout();">退出</a></li>
    </ul>
  </div>
  
  <div class="layui-side layui-bg-black">
    <div class="layui-side-scroll">
      <!-- 左侧导航区域（可配合layui已有的垂直导航） -->
      <ul class="layui-nav layui-nav-tree"  lay-filter="test">
        <li class="layui-nav-item layui-nav-itemed">
          <a class="" href="javascript:;">信息维护</a>
          <dl class="layui-nav-child">
            <dd><a href="javascript:openUrl('/web/page/department/list.jsp');">部门信息维护</a></dd>
            <dd><a href="javascript:openUrl('/web/page/employee/list.jsp');">员工信息维护</a></dd>
            <dd><a href="javascript:openUrl('/web/page/project/list.jsp');">项目信息维护</a></dd>
            <dd><a href="javascript:openUrl('/web/page/score/list.jsp');">绩效信息维护</a></dd>
          </dl>
        </li>
        <li class="layui-nav-item">
          <a href="javascript:;">部门信息</a>
          <dl class="layui-nav-child">
            <dd><a href="javascript:;">部门信息维护</a></dd>
          </dl>
        </li>
        <li class="layui-nav-item">
          <a href="javascript:;">员工信息</a>
          <dl class="layui-nav-child">
            <dd><a href="javascript:;">员工信息维护</a></dd>
          </dl>
        </li>
        <li class="layui-nav-item">
          <a href="javascript:;">项目信息</a>
          <dl class="layui-nav-child">
            <dd><a href="javascript:;">项目信息维护</a></dd>
          </dl>
        </li>
        <li class="layui-nav-item">
          <a href="javascript:;">绩效信息</a>
          <dl class="layui-nav-child">
            <dd><a href="javascript:;">绩效信息维护</a></dd>
          </dl>
        </li>
        <li class="layui-nav-item">
          <a href="javascript:;">测试</a>
          <dl class="layui-nav-child">
            <dd><a href="javascript:openUrl('/web/404.jsp');">测试1</a></dd>
          </dl>
           <dl class="layui-nav-child">
            <dd><a href="javascript:;" class='demoA' data-url='/web/404.jsp'>测试2</a></dd>
          </dl>
        </li>
      </ul>
    </div>
  </div>
  
  <div class="layui-body">
    <!-- 内容主体区域 -->
	<iframe name='frameA' width='99%' height='97%'></iframe>
  </div>
  
  <div class="layui-footer">
    <!-- 底部固定区域 -->
    © java - 底部固定区域
  </div>
</div>
<script>
$('.demoA').click(function(){//jQuery动态绑定
	window.open(base.app+$(this).data('url'),'frameA')
})

function openUrl(url){//静态绑定
	window.open(base.app+url,'frameA')
}

// function openResetPsd(){
// 	 layer.open({
// 		type:2,//iframe
// 		area:['750px','450px'],
// 		maxmin:true,
// // 		end:function(){
// // 			refresh();
// // 		},
// 		content:base.app+"/web/page/employee/updpass.jsp"
// 	}) 
// }
	
// 	req.getSession().setAttribute("user", mdb);

function toLogout(){
	openConfirm(function(index){//提炼确认操作方法
		location.href=base.app+'/employee?action=logout'//href进入servlet使用get
			},"是否退出？")
// 	layer.confirm("确定退出？", {icon: 3, title:'提示'}, function(index){
// 		location.href=base.app+'/employee?action=logout'
// 				//href进入servlet使用get
// 	});
}

//   var element = layui.element;
  element.render();
  function updamge(){
	  var code='${user.code}';
	  console.log("跳转========="+code)
// 	  toJsp("/web/page/employee/userpic.jsp?code="+code)
// 	  window.open("/web/page/employee/userpic.jsp?code="+code,'frameA')
	  layer.open({
			type:2,//iframe
			area:['750px','450px'],
			maxmin:true,
			end:function(){
			  refresh(code);
 			     },
			content:base.app+"/web/page/employee/userpic.jsp?code="+code
		})
  }
  
  function refresh(code){ //更换头像后，刷新session里存的user
	  location.href=base.app+'/employee?action=refhead&code='+code
  }


</script>
</body>
</html>